import service from "@/api/index.js";

const goodsApi = {
    // 分页查询
    getByCondition: (condition, pageNum, pageSize) => {
        condition.pageNum = pageNum
        condition.pageSize = pageSize
        return service.get('/goods', {params: condition})
    },
    // 新增
    addInfo: (goods) => {
        return service.post('/goods', goods)
    },
    // 更新
    updateInfo: (goods) => {
        return service.put('/goods', goods)
    },
    // 删除
    delInfo: (id) => {
        return service.delete(`/goods/${id}`)
    },
    // 通过id查询
    getById: (id) => {
        return service.get(`/goods/${id}`)
    },
//     前台用户进行搜索
    getGoodsList: (condition, pageNum, pageSize) => {
        condition.pageNum = pageNum
        condition.pageSize = pageSize
        return service.get('/goods/list', {params:condition})
}
}

export default goodsApi;